﻿CREATE VIEW dbo.VIEW_SEARCH_DIRECT
AS
SELECT     dbo.CONTRACT.NUMBER AS CONTRACT_NUM, dbo.NSI_ORGANIZATION.SHORT_NAME AS NSI_ORGANIZATION_SHORT_NAME, 
                      dbo.NSI_TYPE_OF_ACTIVITY.NAME AS NSI_TYPE_OF_ACTIVITY_NAME, dbo.DIRECT.PID, dbo.DIRECT.ID, dbo.DIRECT.NUMBER, 
                      dbo.DIRECT.DATE
FROM         dbo.CONTRACT INNER JOIN
                      dbo.DIRECT ON dbo.CONTRACT.PID = dbo.DIRECT.PID LEFT OUTER JOIN
                      dbo.NSI_TYPE_OF_ACTIVITY ON dbo.CONTRACT.NSI_TYPE_OF_ACTIVITY_ID = dbo.NSI_TYPE_OF_ACTIVITY.ID LEFT OUTER JOIN
                      dbo.NSI_ORGANIZATION ON dbo.CONTRACT.NSI_ORGANIZATION_ID = dbo.NSI_ORGANIZATION.ID